package reflection;

public class ReflectClasses {
  public static void main(String[] args) {
    Class c = "foo".getClass();
    System.out.println("Class c is : " + c.getName());
    
    //Another way to get the String class
    c = String.class;
    System.out.println("Class c is still : " + c.getName());
    
    c = MyHello.class;
    System.out.println("MyHello c is : " + c.getName());
    
    //primitive class
    c = Double.TYPE;
    System.out.println("double class : " + c.getName());
    c = Long.TYPE;
    System.out.println("Long class : " + c.getName());
    
    //byte array class
    byte[] bytes = new byte[1024];
    c = bytes.getClass();
    System.out.println("byte array class : " + c.getName());
 
    //String array class
    String[] sa = new String[10];
    c = sa.getClass();
    System.out.println("String array class : " + c.getName());
    
    //Integer array class
    Integer[] ia = new Integer[10];
    c = ia.getClass();
    System.out.println("Integer array class : " + c.getName());
    
    try{
      Class s = Class.forName("java.util.ArrayList");
      System.out.println("The class is : " + s);
    }
    catch (ClassNotFoundException e){
      e.printStackTrace();
    }
    
  }
}
